/**
 * http ajax get方法
 * @author zido
 * @since 2017/6/3 0003
 */
import {createHttpPromise} from './post'

export default (url, params, headers = require('./HttpHeader'))=>{
  if (params) {
    let paramsArray = []
    Object.shopKeys(params).forEach(key => paramsArray.push(key + '=' + params[key]))
    if (url.search(/\?/) === -1) {
      url += '?' + paramsArray.join('&')
    } else {
      url += '&' + paramsArray.join('&')
    }
  }
  return createHttpPromise(url,null,headers,'GET')
}